﻿<UserControl x:Class="Squiggle.UI.Controls.ChatItems.Activity.FileTransferControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:Squiggle.UI.Controls"
    xmlns:converters="clr-namespace:Squiggle.UI.Converters"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d" 
    d:DesignHeight="100" d:DesignWidth="300"
    x:Name="fileTransferControl">
    <UserControl.Resources>
        <converters:FileToIconConverter x:Key="fic" />
    </UserControl.Resources>
    <Grid>
        <WrapPanel Orientation="Horizontal">
            <StackPanel Margin="0,0,100,0" DataContext="{Binding ElementName=fileTransferControl, Path=FileName}" Orientation="Horizontal" >
                <Image x:Name="img" Height="32" Width="32"
                           ToolTip="{Binding Converter={x:Static converters:PathToNameConverter.Instance}}">
                    <Image.Source>
                        <MultiBinding Converter="{StaticResource fic}">
                            <Binding />
                        </MultiBinding >
                    </Image.Source>
                </Image>
                <StackPanel Margin="5,5,0,0" VerticalAlignment="Bottom" Orientation="Vertical">
                    <TextBlock FontSize="10" Text="{Binding Converter={x:Static converters:PathToNameConverter.Instance}}"
                                   TextTrimming="CharacterEllipsis" VerticalAlignment="Bottom"/>
                    <TextBlock Margin="0,0,0,0" Foreground="Gray" FontSize="10" Text="{Binding ElementName=fileTransferControl, Path=Status}"/>
                </StackPanel>
            </StackPanel>
            <Grid>
                <StackPanel x:Name="stkInvitation" Orientation="Horizontal" Visibility="Hidden">
                    <Button Content="{StaticResource Activity_Accept}" VerticalContentAlignment="Center" FontSize="9" Height="15" Width="60" Margin="5,0,0,0" Click="Accept_Click" 
                            Template="{DynamicResource BlackGlassButton}" Foreground="White"/>
                    <Button Content="{StaticResource FileTransfer_SaveAs}" VerticalContentAlignment="Center" FontSize="9" Height="15" Width="60" Margin="5,0,0,0" Click="SaveAs_Click"  
                            Template="{DynamicResource BlackGlassButton}" Foreground="White"/>
                    <Button Content="{StaticResource Activity_Reject}" VerticalContentAlignment="Center" FontSize="9" Height="15" Width="60" Margin="5,0,0,0" Click="Reject_Click"
                            Template="{DynamicResource BlackGlassButton}" Foreground="White"/>
                </StackPanel>
                <StackPanel x:Name="stkWaitingAcceptance" Orientation="Horizontal" Visibility="Hidden">
                    <ProgressBar IsIndeterminate="True" Width="200" Height="15"/>
                    <Button x:Name="btnCancelTransfer" Content="{StaticResource Activity_Reject}" VerticalContentAlignment="Center" FontSize="9" Height="15" Width="60" Margin="10,0,0,0" Click="Reject_Click"
                            Template="{DynamicResource BlackGlassButton}" Foreground="White"/>
                </StackPanel>
                <StackPanel x:Name="stkAccepted" Orientation="Horizontal" Visibility="Hidden">
                    <ProgressBar x:Name="progress" Height="15" Width="200"/>
                    <Button Content="{StaticResource Activity_Cancel}" VerticalContentAlignment="Center" FontSize="9" Height="15" Width="60" Margin="5,0,0,0" Click="Reject_Click" 
                            Template="{DynamicResource BlackGlassButton}" Foreground="White"/>
                </StackPanel>
                <StackPanel x:Name="stkCompleted" Orientation="Horizontal" Visibility="Hidden">
                    <Button Content="{StaticResource FileTransfer_Open}" VerticalContentAlignment="Center" FontSize="9" Height="15" Width="60" Margin="0,0,30,0" Click="Open_Click"
                            Template="{DynamicResource BlackGlassButton}" Foreground="White"/>
                    <TextBlock VerticalAlignment="Center" FontSize="10">
                        <Hyperlink Click="ShowInFolder_Click"><TextBlock Text="{StaticResource ChatWindow_ShowInFolder}" /></Hyperlink>
                    </TextBlock>
                </StackPanel>
            </Grid>
        </WrapPanel>
       
    </Grid>
</UserControl>
